//
//  CalendarModel.swift
//  DaRings
//
//  Created by HFY on 2022/12/2.
//

import UIKit
import HandyJSON
import MYModule

open class CalendarModel: HandyJSON {
    
   public enum ModelType: Int, HandyJSONEnum {
       /// 每月1日之前的空model
       case past = -1
       
       /// 月内的空model
       case empty = 0
       
        /// 真实的model
        case real = 1
       
        /// 未来日期的空model
        case future = 2
    }
    
    public var type: ModelType = .real
    
    public var day = 0
    public var month = 0
    public var year = 0

    public var sqliteModel: MYSQLiteTableiabe? {
        
        didSet {
            
            guard let sqliteModel = sqliteModel else {
                return
            }
            year = sqliteModel.year
            month = sqliteModel.month
            day = sqliteModel.day
            
        }
        
    }
    
    public var fillColor: UIColor? = .green
    public var bgColor: UIColor? = .clear
    
    /// 是否是被点击状态
   public var isSelected: Bool = false
    
    private(set) var isEmpty: Bool = false
    
    public static func empty(type: ModelType) ->CalendarModel {
        
        let model = CalendarModel()
        model.isEmpty = true
        model.type = type
        return model
        
    }
    
   public required init() { }
}
